<template>
  <div class="container">
    <div>学生的姓名:{{ name | mySlice}}</div>
    <h1>学生的年龄:{{ age }}</h1>
    <button @click="sendSchoolName">点我把数据传递给school组件</button>
  </div>
</template>
<script>
import pubsub from 'pubsub-js'
export default {
  name: "Student",
  data(){
      return{
          name:'老黑hhhhhhhhhh',
          age:18
      }
  },
  methods:{
    sendSchoolName(){
      // this.$bus.$emit('hello',this.name);
      pubsub.publish('hello',this.name)
    }
  }
};
</script>
<style scoped>
.container {
  background-color: aqua;
}
</style>
